package horncomb.bpm;

import java.util.List;

import horncomb.bpm.process.ProcessManager;
import horncomb.bpm.task.TaskManager;
import horncomb.bpm.task.core.TaskInstance;

import org.springframework.util.Assert;

/**
 * @author Daniel
 */
public class BpmContext {
	private ProcessManager processManagementService;
	private TaskManager taskManagementServcie;
	private String currentActor;

	public BpmContext(ProcessManager session) {
		Assert.notNull(session);
		this.processManagementService = session;
	}

	public BpmContext(ProcessManager processManager, TaskManager taskManager) {
		Assert.notNull(processManager);
		Assert.notNull(taskManager);
		this.processManagementService = processManager;
		this.taskManagementServcie = taskManager;
	}

	/**
	 *
	 */
	public List<? extends TaskInstance> findTodoTasks() {
		return this.taskManagementServcie.findActorTodoTaskInstances(this
				.getCurrentActor());
	}

	/**
	 * @return the session
	 */
	public ProcessManager getProcessManagementService() {
		return processManagementService;
	}

	/**
	 * @param session
	 *            the session to set
	 */
	public void setProcessManagementService(ProcessManager session) {
		this.processManagementService = session;
	}

	/**
	 * @return the taskManagementServcie
	 */
	public TaskManager getTaskManagementServcie() {
		return taskManagementServcie;
	}

	/**
	 * @param taskManagementServcie
	 *            the taskManagementServcie to set
	 */
	public void setTaskManagementServcie(TaskManager taskManagementServcie) {
		this.taskManagementServcie = taskManagementServcie;
	}

	/**
	 * @return the currentActor
	 */
	public String getCurrentActor() {
		return currentActor;
	}

	/**
	 * @param currentActor
	 *            the currentActor to set
	 */
	public void setCurrentActor(String currentActor) {
		this.currentActor = currentActor;
	}
}
